package cn.com.se.sharepictrue.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;


import java.util.List;

import cn.com.se.sharepictrue.bean.FragmentPager;

/**
 * Created by benio on 2015/10/30.
 */
public class BaseFragmentPagerAdapter extends FragmentStatePagerAdapter {

    private List<FragmentPager> mFragmentList;

    public BaseFragmentPagerAdapter(FragmentManager fm, List<FragmentPager> list) {
        super(fm);
        this.mFragmentList = list;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return null == mFragmentList ? null : mFragmentList.get(position).getTitle();
    }

    @Override
    public Fragment getItem(int position) {
        return null == mFragmentList ? null : mFragmentList.get(position).getFragment();
    }

    @Override
    public int getCount() {
        return null == mFragmentList ? 0 : mFragmentList.size();
    }
}
